import { Controller, Get, Logger, Render, Req, Request } from '@nestjs/common';
import { HealthCheckService, HttpHealthIndicator } from '@nestjs/terminus';
import { AppService } from './app.service';
import { cpus, version } from 'os';

@Controller()
export class AppController {
  constructor(
    private readonly appService: AppService,
    private health: HealthCheckService,
    private http: HttpHealthIndicator,
  ) {}
  private readonly logger = new Logger(AppController.name);

  @Get()
  @Render('index')
  root() {
    return {
      message: 'Serverless Framework',
    };
  }
  @Get('/info')
  getInfo(@Req() request: Request) {
    this.logger.log('request', JSON.stringify(request.headers));
    this.logger.log('get-info');
    return cpus();
  }
}
